package Day03_Channel相关.handler;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@ChannelHandler.Sharable //todo 多个pipeline共享一个ChannelHandler，必须添加@ChannelHandler.Sharable注解
public class ServerInHandler1 extends ChannelInboundHandlerAdapter {
    private int count;

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        count++;
        log.info("count is: {}", count);
        log.info("in 1");
//        ctx.channel().writeAndFlush("叶航1");
        super.channelRead(ctx, msg);
    }

}
